package com.hsav.kcxb.activity;

import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.design.widget.TabLayout;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.hsav.kcxb.R;

public class ScoreActivity extends BaseActivity implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_score);
        initView();
    }

    private void initView() {
        ImageView imgBack = (ImageView) findViewById(R.id.img_back);
        imgBack.setOnClickListener(this);

        TextView textShare = (TextView) findViewById(R.id.text_share);
        textShare.setOnClickListener(this);

        TextView textScore = (TextView)findViewById(R.id.text_score);
        textScore.setText("100分");

        TextView textMsg = (TextView)findViewById(R.id.text_msg);
        textMsg.setText("击败全国99%的观众");

        TextView textAddVideo = (TextView) findViewById(R.id.text_add_video);
        textAddVideo.setOnClickListener(this);

        ImageButton btnPlay = (ImageButton) findViewById(R.id.btn_play);
        btnPlay.setOnClickListener(this);

        TextView textCurrTime = (TextView) findViewById(R.id.text_curr_time);
        textCurrTime.setText("00:00");

        TextView textTotalTime = (TextView) findViewById(R.id.text_total_time);
        textTotalTime.setText("03:12");

        RadioGroup groupMusicClass = (RadioGroup) findViewById(R.id.group_music_class);
        groupMusicClass.setOnCheckedChangeListener(this);

        ImageView imgAgain = (ImageView) findViewById(R.id.img_again);
        imgAgain.setOnClickListener(this);

        TextView textSave = (TextView) findViewById(R.id.text_save);
        textSave.setOnClickListener(this);

        ImageView imgVolume = (ImageView) findViewById(R.id.img_volume);
        imgVolume.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId())
        {
            case R.id.img_back:
                finish();
                break;
            case R.id.text_share:
                Toast.makeText(this, "晒成绩按钮被点击了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.text_add_video:
                Toast.makeText(this, "添加视频按钮被点击了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.btn_play:
                Toast.makeText(this, "播放按钮被点击了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.img_again:
                Toast.makeText(this, "重来按钮被点击了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.text_save:
                Toast.makeText(this, "保存按钮被点击了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.img_volume:
                Toast.makeText(this, "音量调节按钮被点击了", Toast.LENGTH_SHORT).show();
                break;
        }
    }

    @Override
    public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
        switch (checkedId)
        {
            case R.id.radio_lx:
                Toast.makeText(this, "流行被选中了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.radio_rb:
                Toast.makeText(this, "R&B被选中了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.radio_yg:
                Toast.makeText(this, "摇滚被选中了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.radio_wq:
                Toast.makeText(this, "舞曲被选中了", Toast.LENGTH_SHORT).show();
                break;
            case R.id.radio_dy:
                Toast.makeText(this, "电音被选中了", Toast.LENGTH_SHORT).show();
                break;
        }
    }
}
